#import <Foundation/Foundation.h>

@protocol JokeManagerDelegate;

@interface JokeManager : NSObject
{
    NSString *httpSort;
    int backIndex;
    NSMutableArray          *listNext;
    NSMutableSet            *setShow;
    NSMutableDictionary     *dicLocal;
    id<JokeManagerDelegate> delegate;
    BOOL                    started;
}

@property (nonatomic,assign)    int             sortIndex;
@property (nonatomic,copy)      NSString        *dbSort;
@property (atomic,retain)       NSMutableArray  *listShow;
@property (atomic,assign)       BOOL            gettingNext;
@property (atomic,assign)       BOOL            gettingNew;

-(id)initWithSort:(int)pSortIndex :(NSString *)pDBsort :(NSString *)pHTTPsort :(id<JokeManagerDelegate>) pDelegate;
-(void)removeLikeState;

-(void)getStartAsync:(BOOL)textOnly;
-(void)getNewAsync:(BOOL)textOnly;
-(void)getNextAsync:(BOOL)textOnly;
-(void)getNewAndNextAsync:(BOOL)textOnly;

-(int)httpIsLikedSync:(NSString *)jokeId;
-(int)httpIsUnlikedSync:(NSString *)jokeId;

-(NSMutableArray *)httpGetReplySync:(NSString *)jokeId;

-(BOOL)httpLikedSync:(NSString *)jokeId;
-(BOOL)httpUnlikedSync:(NSString *)jokeId;

-(void)clearJokeData;

@end

@protocol JokeManagerDelegate<NSObject>
@optional
-(void)JMloadNew:(JokeManager *)pJokeManager :(int)newCount;
-(void)JMloadNext:(JokeManager *)pJokeManager :(int)nextCount;
-(void)JMloadNewAndNext:(JokeManager *)pJokeManager :(int)newCount :(int)nextCount;
@end
